from gameset.phoenicia.base import *

from .pottery import Pottery


class Water(Beverage):
    singular  =_ ('Water')
    plural    =_ ('Water')
    happiness =_ (2.0)
    consumed  =_ (2)


class Fountain(Building, HomeSupplier, FertilityDependent):
    name        =_ ('Fountain')
    size        =_ (2)
    cost        =_ (50)
    staff       =_ (4)
    color       =_ (Blue)
    stores      =_ (Water(400), Pottery(100))
    demand      =_ ([Pottery])
    supply      =_ ([Water])
    home_supply =_ ([Beverage])
    
    @property
    def water_per_day(self):
        return Water(int(self.efficiency * 25))
    
    @property
    def efficiency(self):
        return self.fertility_modifier * self.staffing_level ** 2
    
    def day(self, day, month, year):
        if self.has_some(Pottery):
            self.consume(Pottery(1))
            self.create(self.water_per_day)
    
    @property
    def state(self):
        return {'Fertility': lambda: str(int(self.fertility * 100)) + '%',
                'Per Day'  : lambda: str(self.water_per_day)}
